package asa;

import Lexer.*;

public class UnaryExpr extends Expr {

    public UnaryExpr( Expr expr, Symbol op ) {
        this.expr = expr;
        this.op = op;
    }

    @Override
	public void genJava(PWInterface pw) {
    	genJava(pw, false);
    }

    @Override
	public void genJava(PWInterface pw, boolean putParenthesis ) {
        switch ( op ) {
            case PLUS :
              pw.print("+");
              break;
            case MINUS :
              pw.print("-");
              break;
            case NAO :
              pw.print("!");
              break;
        }
        expr.genJava(pw, false);
    }

    private Expr expr;
    private Symbol op;
}
